<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <button>体制动画</button>
    <script>
        let num = 0
        let outId = setTimeout(function () {
            num++
            console.log(num)
        }, 1000)

        let timer = setInterval(function () {
            num++
            console.log(num)
            console.log(typeof timer)
            if(num>5){
                clearInterval(timer)
            }
        }, 1000)

        // let outId2 = setTimeout(function () {
        //     clearInterval(id)
        //     clearTimeout(outId)
        //     clearTimeout(outId2)
        // }, 10000)
        let btn = document.getElementsByTagName('button')[0]
        btn.onclick = function () {
            // clearInterval(id)
            clearTimeout(id)
        }
    </script>
</body>

</html>